
// 开启命名空间之后,state的使用方式和之前模块化的使用方式一样
const state = {
  count: 2
}

const mutations = {
  ADD(state) {
    state.count = state.count + 1;
  }
}

const actions = {
  increment({ commit }) {
    commit('ADD')
  }
}

const getters = {
  tenflodCount(state) {
    return state.count * 10
  }
}

export default {
  namespaced: true, // 开启命名空间
  state,
  mutations,
  actions,
  getters,
}